package com.xc58.highreactor.seril;

import static com.xc58.highreactor.util.ByteUtil.*;

import java.io.InputStream;

import com.xc58.highreactor.exception.ParseDataException;

public class LongSerializer implements ISerializer<Long> {

	public byte[] serialize(Long rawObject) throws Exception {
		return getByteFormLong(rawObject.longValue());
	}

	public Long deserialize(InputStream input) throws Exception {
		byte[] bytes = new byte[8];
		if(input.read(bytes) < 8){
			throw new ParseDataException();
		}
		return toLong(bytes);
	}

}
